﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ctrlEntraMercaFapep.ascx.cs" Inherits="EstoqueUnifeiADO.Controles.ctrlEntraMercaFapep" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:ObjectDataSource ID="odsFornecedores" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetData" TypeName="EstoqueUnifeiADO.Dados.dsFornecedoresTableAdapters.FORNECEDORTableAdapter">
</asp:ObjectDataSource>

<asp:ObjectDataSource ID="odsProdutos" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetData" TypeName="EstoqueUnifeiADO.Dados.dsProdutosTableAdapters.PRODUTOTableAdapter">
</asp:ObjectDataSource>
<asp:ValidationSummary ID="vsctrl" runat="server" BorderColor="Red" 
    BorderStyle="Solid" BorderWidth="2px" ForeColor="Red" />
<asp:Wizard ID="Wizard1" runat="server" Width="98%" ActiveStepIndex="0" OnFinishButtonClick="Wizard1_FinishButtonClick"
    OnNextButtonClick="Wizard1_NextButtonClick" DisplaySideBar="False">
    <StartNavigationTemplate>
        <asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext" Text="Adicionar items"
            CausesValidation="true" ValidationGroup="startGroupF" />
    </StartNavigationTemplate>
    <StepNavigationTemplate>
        <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
            Text="Previous" />
        <asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="Next"
            CausesValidation="true" ValidationGroup="stepGroupF" />
    </StepNavigationTemplate>
    <WizardSteps>
        <asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" BorderColor="Red"
                BorderWidth="2px" ValidationGroup="startGroupF" />
            <table style="width: 98%">
                <tr>
                    <td colspan="2">
                        Fornecedor:<br />
                        <asp:DropDownList ID="ddlFornecedor" runat="server" Width="100%" DataSourceID="odsFornecedores"
                            DataTextField="CAPTION" DataValueField="CODFORNECEDOR" AppendDataBoundItems="true">
                            <asp:ListItem Value="" Text="Selecione um fornecedor" />
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Campo obrigatório"
                            ControlToValidate="ddlFornecedor" Display="Dynamic" Text="*" ForeColor="Red"
                            ValidationGroup="startGroupF"></asp:RequiredFieldValidator>
                        <br />
                    </td>
                </tr>
                <tr>
                    <td>
                        Data de entrada:<br />
                        <asp:TextBox ID="DATAENTRAMERCALabel" runat="server" />
                        <asp:CalendarExtender ID="DATAENTRAMERCALabel_CalendarExtender" runat="server" Enabled="True"
                            TargetControlID="DATAENTRAMERCALabel" Format="dd/MM/yyyy">
                        </asp:CalendarExtender>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Campo obrigatório"
                            ControlToValidate="DATAENTRAMERCALabel" Display="Dynamic" Text="*" ForeColor="Red"
                            ValidationGroup="startGroupF"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        Número da nota:<br />
                        <asp:TextBox ID="NUMERONOTALabel" runat="server" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Campo obrigatório"
                            ControlToValidate="NUMERONOTALabel" Display="Dynamic" Text="*" ForeColor="Red"
                            ValidationGroup="startGroupF"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                
                    <td>
                    Número Confirmação de compra:<br />
                    <asp:TextBox ID="tbNumeroConfirmacao" runat="server" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Campo obrigatório"
                            ControlToValidate="tbNumeroConfirmacao" Display="Dynamic" Text="*" ForeColor="Red"
                            ValidationGroup="startGroupF"></asp:RequiredFieldValidator>
                    </td>
                </tr>
            </table>
        </asp:WizardStep>
        <asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2">
            <asp:FormView ID="FormView1" runat="server" Width="100%" OnPreRender="FormView1_PreRender">
                <ItemTemplate>
                    <table style="width: 98%">
                        <tr>
                            <td colspan="3">
                                Fornecedor:<br />
                                <asp:TextBox ID="TextBox1" runat="server" Width="98%" Enabled="false" Text='<%# Eval("Fornecedor") %>' />
                                <br />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Data de entrada:<br />
                                <asp:TextBox ID="DATAENTRAMERCALabel" runat="server" Enabled="false" Text='<%# Eval("Data") %>' />
                            </td>
                            <td>
                                Número da nota:<br />
                                <asp:TextBox ID="NUMERONOTALabel" runat="server" Enabled="false" Text='<%# Eval("Numeronota") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                Confirmação de compra:<br />
                                <asp:TextBox ID="NUMEROEMPENHOLabel" runat="server" Enabled="false" Text='<%# Eval("NumeroConfirmacao") %>' />
                            </td>
                            
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:FormView>
            <table style="width: 100%">
                <tr>
                    <td colspan="4">
                        <asp:ValidationSummary ID="ValidationSummary2" runat="server" BorderColor="Red" BorderStyle="Solid"
                            BorderWidth="2px" ForeColor="Red" ValidationGroup="vgAdicionaf" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 40%">
                        Produto:
                    </td>
                    <td style="width: 20%">
                        Valor:
                    </td>
                    <td style="width: 20%">
                        Quantidade:
                    </td>
                    <td style="width: 20%">
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:DropDownList ID="ddlProduto" runat="server" Width="95%" DataSourceID="odsProdutos"
                            DataTextField="TITULO" DataValueField="CODPRODUTO" AppendDataBoundItems="true" ValidationGroup="vgAdicionaf">
                            <asp:ListItem Text="Selecione um produto" Value="" />
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="Campo obrigatório"
                            ControlToValidate="ddlProduto" Display="Dynamic" Text="*" ForeColor="Red" ValidationGroup="vgAdicionaf"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        <asp:TextBox ID="tbValorUnit" runat="server" Width="90%"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="Campo obrigatório"
                            ControlToValidate="tbValorUnit" Display="Dynamic" Text="*" ForeColor="Red" ValidationGroup="vgAdicionaf"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        <asp:TextBox ID="tbQuantidade" runat="server" Width="90%"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="Campo obrigatório"
                            ControlToValidate="tbQuantidade" Display="Dynamic" Text="*" ForeColor="Red" ValidationGroup="vgAdicionaf"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        <asp:Button ID="Button1" runat="server" Text="Adicionar" ValidationGroup="vgAdicionaf"
                            OnClick="Button1_Click" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        Items:<br />
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" ShowFooter="True"
                            DataKeyNames="Cod" Width="100%" CellPadding="4" ForeColor="#333333" GridLines="None"
                            OnRowDataBound="GridView1_RowDataBound" 
                            OnRowCommand="GridView1_RowCommand">
                            <AlternatingRowStyle BackColor="White" />
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/images/Icones/delete.png"
                                            CommandName="Del" ToolTip="Excluir registro" CommandArgument='<%#Eval("Cod") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:BoundField DataField="produto" HeaderText="Produto" />
                                <asp:BoundField DataField="valor" HeaderText="Valor Unit." DataFormatString="{0:c}" />
                                <asp:BoundField DataField="quantidade" HeaderText="Quantidade" />
                                <asp:TemplateField HeaderText="Valor Total">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lbValorTotal" Text='<%# Eval("total","{0:c}") %>' />
                                    </ItemTemplate>
                                    
                                </asp:TemplateField>
                            </Columns>
                            <EditRowStyle BackColor="#2461BF" />
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#EFF3FB" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <SortedAscendingCellStyle BackColor="#F5F7FB" />
                            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                            <SortedDescendingCellStyle BackColor="#E9EBEF" />
                            <SortedDescendingHeaderStyle BackColor="#4870BE" />
                        </asp:GridView>
                    </td>
                </tr>
            </table>
        </asp:WizardStep>
    </WizardSteps>
</asp:Wizard>